<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

<title>修改商品</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="css/bootstrap-responsive.css" />
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/toastr.css" />
<link rel="stylesheet" href="css/fullcalendar.css" />
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery.knob.js"></script>
<script src="js/jquery.sparkline.min.js"></script>
<script src="js/toastr.js"></script>
<script src="js/jquery.tablesorter.min.js"></script>
<script src="js/jquery.peity.min.js"></script>
<script src="js/fullcalendar.min.js"></script>
<script src="js/gcal.js"></script>
<script src="js/setup.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<script type="text/javascript">
	$(function() {
		//异步访问
		$.ajax({
			url : "findThree.category",
			dataType : "json",
			success : function(categories) {
				for (i = 0; i < categories.length; i++) {
					var c = categories[i];
					$("<option value='"+c.id+"'>" + c.name + "</option>")
							.appendTo("#findThree");
				}
			}
		});

		//修改价格
		$("#normalprice").blur(
				function() {
					$("#memberprice").val(
							Math.round($(this).val() * .8 * 100.0) / 100.0);
				});
	});
</script>

</head>
<body>
	<!-- header部分 -->

	<%@include file="header.jsp"%>

	<div class="page">
		<div class="page-container">
			<div class="container">
				<div class="row">
					<div class="span12">
						<h4 class="header">修改商品</h4>
						<form action="update.product" method="post">
							<table class="table table-striped sortable">
								<thead>
								</thead>
								<tbody>
									<tr>
										<th>商品名称</th>
										<td><input type="hidden" name="id" value="${p.id}" /> <input
											type="text" name="name" value="${p.name }" /></td>
									</tr>
									<tr>
										<th>商品描述</th>
										<td><textarea rows="5" cols="20" name="descr">${p.descr }</textarea></td>
									</tr>

									<tr>
										<th>普通价格</th>
										<td><input id="normalprice" type="text"
											name="normalprice" value="${p.normalprice }" /></td>
									</tr>

									<tr>
										<th>会员价格</th>
										<td><input id="memberprice" type="text"
											name="memberprice" value="${p.memberprice }"
											readonly="readonly" /></td>
									</tr>

									<tr>
										<th>所属类别</th>
										<td><select id="findThree" name="categoryid">
										</select></td>
									</tr>

									<tr>
										<td></td>
										<td><input class="btn btn-success" type="submit"
											value="修改" />&nbsp;&nbsp;&nbsp;<input class="btn btn-danger"
											type="reset" value="重置" /></td>
										<td></td>
										<td></td>
										<td></td>
									</tr>
								</tbody>
							</table>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<%@include file="footer.jsp"%>
</body>
<script src="js/d3-setup.js"></script>
</html>